package com.study.service.impl;

import com.study.utils.SpringUtils;
import org.springframework.aop.support.AopUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author tanglingyu
 * @Date: 2021/04/15/ 9:46
 * @Description
 */
@Service
public class PropagationTest {

  //  @Transactional(rollbackFor = {Exception.class}, propagation = Propagation.REQUIRED)
  public String test1() {
    System.out.println(this);
    boolean a = AopUtils.isAopProxy(this);
    System.out.println(a);
    PropagationTest bean = SpringUtils.getBean(PropagationTest.class);
    System.out.println(bean);
//    return bean.test2();
    return test2();
  }


  @Transactional(rollbackFor = {Exception.class}, propagation = Propagation.REQUIRED)
  public String test2() {
    return "test2";
  }

}
